package com.mspbots.rule.queue.attendance;

import com.mspbots.cw.request.TenantUserConfigurationDTO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @ClassName com.mspbots.rule.queue.attendance.LateWorkEndQueue
 * @Description TODO
 * @Author Jun
 * @Date 2019/10/10 16:26
 * @Version 1.0
 **/
@Slf4j
@Component
public class LateWorkEndQueue extends AttendanceBaseQueue {

    private static final String START_RULE_NAME = "LateWorkEnd";

    @RabbitListener(queues = "trigger.attendance.LateWorkEnd")
    public void onQueue(List<TenantUserConfigurationDTO> tenantUserConfigurationDTOList) {
        tenantUserConfigurationDTOList
                .parallelStream()
                .forEach(
                        tenantUserConfigurationDTO -> super.onRule(START_RULE_NAME, tenantUserConfigurationDTO)
                );
    }


}
